<?php
/**
 * desc Created by wang.
 * User: wang
 * motto: 是时候为小时候吹过的牛而努力了!
 * Date: 2020/3/23 16:10
 */

namespace app\admin\validate;


use think\Validate;

class Role extends Validate
{
    protected $rule = [
        'name' => 'require',
        'status' => ['require', 'in'=>'0,1'],
        'id' => 'require|integer',
    ];

    protected $message = [
        'name.require' => '角色名称不能为空',
        'status.require' => '状态不能为空',
        'status.min' => '状态值类型有误',
        'id.require' => 'ID不能为空',
        'id.integer' => 'ID类型值有误',
    ];

    //需要校验的场景
    protected $scene = [
        'add' => ['name', 'status'],
        'edit' => ['name', 'status', 'id'],
        'up' => ['id', 'status'],
        'del' => ['id'],
    ];
}